package com.xyl.services.impl;

import com.xyl.dao.UserMapper;
import com.xyl.entity.User;
import com.xyl.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User getUserByLoginName(String loginName) {
        return userMapper.selectByLoginName(loginName);
    }

    @Override
    public int modify(User user) {
        return userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public User getUserByUserId(Integer userId) {
        return userMapper.selectByPrimaryKey(userId);
    }

    @Override
    public int add(User user) {
        return userMapper.insertSelective(user);
    }
}
